package com.patsnap.data.npd.dw.repository;

import com.patsnap.one.etl.table.dto.TargetTableDto;

import java.util.List;

public interface BaseRepository {
    <T extends TargetTableDto> T queryOneByPrimaryKey(T queryPojo, Class<T> clazz) throws DBException;

    <T extends TargetTableDto> List<T> queryListByPrimaryKey(List<T> queryObjects, Class<T> clazz, int batch) throws DBException;

    <T extends TargetTableDto> boolean upsert(T updatePojo, Class<T> clazz) throws DBException;

    <T extends TargetTableDto> boolean insert(T updatePojo, Class<T> clazz) throws DBException;

    <T extends TargetTableDto> boolean update(T updatePojo, Class<T> clazz) throws DBException;

    <T extends TargetTableDto> boolean delete(T deleteObject, Class<T> clazz) throws DBException;

    <T extends TargetTableDto> boolean batchInsert(List<T> insertObjects, Class<T> clazz, int batchSize) throws DBException;

    <T extends TargetTableDto> boolean batchUpsert(List<T> insertObjects, Class<T> clazz, int batchSize) throws DBException;

    <T extends TargetTableDto> boolean batchUpdate(List<T> updateObjects, Class<T> clazz, int batchSize) throws DBException;

    <T extends TargetTableDto> boolean batchDelete(List<T> deleteObjects, Class<T> clazz, int batchSize) throws DBException;

    <T extends TargetTableDto> boolean deleteByFields(T deleteObject, Class<T> clazz) throws DBException;

    <T extends TargetTableDto> boolean batchDeleteByFields(List<T> deleteObjects, Class<T> clazz, int batchSize) throws DBException;

}
